import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../js/UI.js" as Style
Rectangle {
    id: rect
    property alias m_name: m_NameText_id.text
    property var m_model:memer.model
    property alias a_source: m_head.source
    signal clickSignal()
    color: "transparent"
    width: m_root_id.width
    height: m_lineValue*1.1
    signal enterCignal()
    signal  exitClick()
    Image {
        id: m_head
        width: parent.height*0.8
        height: parent.height*0.8
        anchors.left: parent.left
        anchors.leftMargin: m_lineValue*0.4
        anchors.verticalCenter: parent.verticalCenter
        onStatusChanged: {
            if(status == Image.Error) source="qrc:/images/message/gray_head_many.png"
        }
    }

    Item {
        width: m_root_id.width - m_lineValue*1.8
        anchors.left: m_head.right
        anchors.leftMargin: m_lineValue*0.2
        height: parent.height*0.8
        anchors.verticalCenter: parent.verticalCenter
        AText {
            visible: m_name!=="" ? true : false
            anchors.left: parent.left
            anchors.verticalCenter: parent.verticalCenter
            id: m_NameText_id
            width: parent.width
            font.pointSize: 16
            elide: Text.ElideRight
            wrapMode: Text.NoWrap
        }
        Row{
            id:groupmemer
            visible: m_name=="" ? true : false
            anchors.left: parent.left
            anchors.verticalCenter: parent.verticalCenter
            Repeater{
              id:memer
                delegate: AText{
                    text:model.description
                    height: parent.height
                    anchors.verticalCenter: parent.verticalCenter
                    font.pointSize: 16
                    elide: Text.ElideRight
                }
            }
        }
    }
    MouseArea {
        id: mouseArea
        anchors.fill: parent
        onClicked: {
            clickSignal()
        }
        onEntered: enterCignal()
        onExited: exitClick()
        hoverEnabled:true
    }
    states: State {
        name: "pressed"; when: mouseArea.pressed
        PropertyChanges { target: rect ; color: Style.transparent_color;}
    }
    transitions: Transition {
        ColorAnimation { duration: duration_time }
    }
}

